package com.yunlongcoding.cahuomarketing.param;

import com.yunlongcoding.cahuomarketing.utils.CommonPayUtils;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * Created by IntelliJ IDEA.
 *
 * 商城商品添加购物车参数
 *
 * @author 王云龙
 * @version 1.0
 * @date 8/7/2018  5:53 PM
 */
public class MallGoodsParam implements Serializable {

    private static final long serialVersionUID = 7612733280343438193L;

    // 会员id 1
    private Long memberId;

    // 商品id 1
    private Long goodsId;

    // 商品是否包含有规格（标识是否含有规格，0是，1不是，如果为0，那么goodsId为空，goodsSpecificationGoodsId不能为空）
    private int isSpecificationGoods ;

    // 商品规格id
    private Long goodsSpecificationId ;

    // 规格名称（如果选的是规格，那么规格名称也不能为空）
    private String specificationName ;

    // 购买数量
    private Integer buyNumber;

    // 商品名称
    private String goodsName;

    // 单个商品所需价格（商品单价）
    private String goodsPrice;

    // 商品总价（计算方法：buy_number * goods_price）
    private String totalPrice;

    // 单个商品所需消费金
    private String goodsConsumerMoney;

    // 商品所需总消费金（计算方法：buy_number * goods_consumer_money）
    private String totalConsumerMoney;

    // 商品所属商城，标识属于商城还是积分商城，0商城，1积分商城
    private Short belongTo;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public Long getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Long goodsId) {
        this.goodsId = goodsId;
    }

    public int getIsSpecificationGoods() {
        return isSpecificationGoods;
    }

    public void setIsSpecificationGoods(int isSpecificationGoods) {
        this.isSpecificationGoods = isSpecificationGoods;
    }

    public String getSpecificationName() {
        return specificationName;
    }

    public void setSpecificationName(String specificationName) {
        this.specificationName = specificationName;
    }

    public Long getGoodsSpecificationId() {
        return goodsSpecificationId;
    }

    public void setGoodsSpecificationId(Long goodsSpecificationId) {
        this.goodsSpecificationId = goodsSpecificationId;
    }

    public Integer getBuyNumber() {
        return buyNumber;
    }

    public BigDecimal getBDBuyNumber() {
        return CommonPayUtils.conversionInteger2BigDecimal(buyNumber) ;
    }

    public void setBuyNumber(Integer buyNumber) {
        this.buyNumber = buyNumber;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getGoodsPrice() {
        return goodsPrice;
    }

    public BigDecimal getBDGoodsPrice() {
        return CommonPayUtils.conversionString2BigDecimal(goodsPrice) ;
    }

    public void setGoodsPrice(String goodsPrice) {
        this.goodsPrice = goodsPrice;
    }

    public String getTotalPrice() {
        return totalPrice;
    }

    public BigDecimal getBDTotalPrice() {
        if (buyNumber == 0 || StringUtils.isEmpty(goodsPrice)) {
            return new BigDecimal(0) ;
        }
        return getBDGoodsPrice().multiply(getBDBuyNumber()) ;
    }

    public void setTotalPrice(String totalPrice) {
        this.totalPrice = totalPrice;
    }

    public String getGoodsConsumerMoney() {
        return goodsConsumerMoney;
    }

    public BigDecimal getBDGoodsConsumerMoney() {
        return CommonPayUtils.conversionString2BigDecimal(goodsConsumerMoney) ;
    }

    public void setGoodsConsumerMoney(String goodsConsumerMoney) {
        this.goodsConsumerMoney = goodsConsumerMoney;
    }

    public String getTotalConsumerMoney() {
        return totalConsumerMoney;
    }

    public BigDecimal getBDTotalConsumerMoney() {
        if (buyNumber == 0 || StringUtils.isEmpty(goodsConsumerMoney)) {
            return new BigDecimal(0) ;
        }
        return getBDGoodsConsumerMoney().multiply(getBDBuyNumber()) ;
    }

    public void setTotalConsumerMoney(String totalConsumerMoney) {
        this.totalConsumerMoney = totalConsumerMoney;
    }

    public Short getBelongTo() {
        return belongTo;
    }

    public void setBelongTo(Short belongTo) {
        this.belongTo = belongTo;
    }

    @Override
    public String toString() {
        return "MallGoodsParam{" +
                "memberId=" + memberId +
                ", goodsId=" + goodsId +
                ", isSpecificationGoods=" + isSpecificationGoods +
                ", goodsSpecificationId=" + goodsSpecificationId +
                ", specificationName='" + specificationName + '\'' +
                ", buyNumber=" + buyNumber +
                ", goodsName='" + goodsName + '\'' +
                ", goodsPrice='" + goodsPrice + '\'' +
                ", totalPrice='" + totalPrice + '\'' +
                ", goodsConsumerMoney='" + goodsConsumerMoney + '\'' +
                ", totalConsumerMoney='" + totalConsumerMoney + '\'' +
                ", belongTo=" + belongTo +
                '}';
    }
}
